Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

feat(compiler): catching unhandled exceptions#77

Open
RossAndersonDev wants to merge 1 commit into
mainfrom
handle-compiler-exceptions
Open

feat(compiler): catching unhandled exceptions#77
RossAndersonDev wants to merge 1 commit into
mainfrom
handle-compiler-exceptions

Conversation

@RossAndersonDev

Copy link
Copy Markdown
Collaborator
  • Adding exception handling in the console app to catch any unhandled
    exceptions.

  • Adding an issue template for bug tracking and linking it in the
    console output if an unhandled exception occurs.

Part of #60

Screenshot of exception output
image

@RossAndersonDev RossAndersonDev force-pushed the handle-compiler-exceptions branch from fe16f7c to 5c71d68 Compare November 6, 2020 16:13
- Adding exception handling in the compiler console app to catch any
unhandled exceptions.

- Adding an issue template for bug tracking and linking it in the
console output if an unhandled exception occurs.

Part of #60
@RossAndersonDev RossAndersonDev force-pushed the handle-compiler-exceptions branch from 5c71d68 to 09406dc Compare November 6, 2020 16:18

@adamconnelly adamconnelly left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - cheers for doing that Ross. I've just added a few really minor suggestions.

Comment thread issue_template.md
@@ -0,0 +1,29 @@
# Bug: -Title-

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can automatically set a few properties like labels by adding some yaml frontmatter to the file. Something like this:

---
name: Bug
about: Use this template for reporting bugs in Thrift.Net.
labels: "type/bug"
---

There's some details about it here: https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/manually-creating-a-single-issue-template-for-your-repository

Should we maybe call the file bug_template.md as well?

Can I get you to move this to a .github directory as well, just so we put anything related to automating GitHub in the one place?

console.Error.Write($"The specified input file '{input.Name}' could not be found.{Environment.NewLine}");
return (int)ExitCode.InputFileNotFound;
}
if (!input.Exists)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth extracting this code out to a method, just to keep the Main() method fairly simple?

console.Out.Write($"Error: {exception}{Environment.NewLine}{Environment.NewLine}");
console.Out.Write($"Thrift.Net has encountered an error. This is a problem with the compiler and not caused by your code.{Environment.NewLine}");
console.Out.Write($"Please help us to resolve this by reporting a new issue here: https://github.com/adamconnelly/Thrift.Net/issues/new?template=issue_template.md. {Environment.NewLine} {Environment.NewLine}");
console.Out.Write($"We welcome contributions, so please feel free to create a PR to resolve the issue.{Environment.NewLine}");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.Out.Write($"We welcome contributions, so please feel free to create a PR to resolve the issue.{Environment.NewLine}");
console.Out.Write($"We welcome contributions, so feel free to create a PR to resolve the issue.{Environment.NewLine}");

After reading it I just figure we had too many "pleases" in there 😸

{
console.Out.Write($"Error: {exception}{Environment.NewLine}{Environment.NewLine}");
console.Out.Write($"Thrift.Net has encountered an error. This is a problem with the compiler and not caused by your code.{Environment.NewLine}");
console.Out.Write($"Please help us to resolve this by reporting a new issue here: https://github.com/adamconnelly/Thrift.Net/issues/new?template=issue_template.md. {Environment.NewLine} {Environment.NewLine}");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could set the component/compiler label via a query string parameter here? Like you say, once the template's in place it'll be easier to try that out.

@adamconnelly

Copy link
Copy Markdown
Owner

@RossAndersonDev you up for finishing this up and getting it merged? Your changes look great, so it'd be awesome to get it in!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants